{include file="layout/layout" /}

<body style="background-color: rgb(255, 255, 255); overflow: auto; cursor: default; -moz-user-select: inherit;">
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <div class="subject">
                <h3>权限资源管理</h3>
                <h5>网站权限资源列表</h5>
            </div>
        </div>
    </div>
    <!-- 操作说明 -->
    <div id="explanation" class="explanation" style="color: rgb(44, 188, 163); background-color: rgb(237, 251, 248); width: 99%; height: 100%;">
        <div id="checkZoom" class="title"><i class="fa fa-lightbulb-o"></i>
            <h4 title="提示相关设置操作时应注意的要点">操作提示</h4>
            <span title="收起提示" id="explanationZoom" style="display: block;"></span>
        </div>
        <ul>
            <li>权限资源非专业人员请勿修改！设置网站相应的权限资源</li>
        </ul>
    </div>

    <div class="flexigrid">
        <div class="mDiv">
            <div class="ftitle">
                <h3>权限资源列表</h3>
                <h5>(共{$list|count}条记录)</h5>
            </div>
            <div title="刷新数据" class="pReload"><i class="fa fa-refresh"></i></div>

            <form class="navbar-form form-inline" action="{:url('System/agent_right')}" method="get">
                <div class="sDiv">
                    <div class="sDiv2">
                        <input type="text" size="30" name="name" class="qsbox" placeholder="搜索相关数据...">
                        <input type="submit" class="btn" value="搜索">
                    </div>
                </div>
            </form>

            <div class="sDiv">
                <div class="fbutton">
                    <a href="{:url('system/add_agent_right')}">
                        <div class="add" title="添加权限资源">
                            <span><i class="fa fa-plus"></i>添加权限</span>
                        </div>
                    </a>
                </div>
            </div>
        </div>
        <div class="hDiv">
            <div class="hDivBox">
                <table cellspacing="0" cellpadding="0">
                    <thead>
                    <tr>
                        <th align="left" abbr="article_title" axis="" class="">
                            <div style="text-align: left; width: 100px;" class="">名称</div>
                        </th>
                        <th align="left" abbr="ac_id" axis="col4" class="">
                            <div style="text-align: left; width: 100px;" class="">资源类型</div>
                        </th>

                        <th align="left" abbr="ac_id" axis="col4" class="">
                            <div style="text-align: left; width:100px;" class="">所属分类</div>
                        </th>
                        <th align="left" abbr="ac_id" axis="col4" class="">
                            <div style="text-align: left; width:400px;" class="">权限码</div>
                        </th>

                        <th align="left" abbr="ac_id" axis="col4" class="">
                            <div style="text-align: left; width:50px;" class="">备注</div>
                        </th>
                        <th align="center" axis="col1" class="handle">
                            <div style="text-align: center; width: 150px;">操作</div>
                        </th>
                        <th style="width:100%" axis="col7">
                            <div></div>
                        </th>
                    </tr>
                    </thead>
                </table>
            </div>
        </div>
        <div class="bDiv" style="height: auto;">
            <div id="flexigrid" cellpadding="0" cellspacing="0" border="0">
                <table>
                    <tbody>
                    {foreach name="list" item="vo" key="k" }
                        <tr>
                            <td align="left" class="">
                                <div style="text-align: left; width: 100px;">{$vo.sm_name}</div>
                            </td>
                            <td align="left" class="">
                                <div style="text-align: left; width: 100px;">{$vo.sm_type}</div>
                            </td>
                            <td align="left" class="">
                                <div style="text-align: left; width: 100px;">{$rolemenu[$vo.sm_group]}</div>
                            </td>
                            <td align="left" class="">
                                <div style="text-align: left; width: 400px;">{$vo.sm_right}</div>
                            </td>

                            <td align="left" class="" >
                                <div onclick="showDesc(this)" style="text-align: left; width: 50px;">{$vo.sm_desc}</div>
                            </td>
                            <td align="center" class="handle">
                                <div style="text-align: center; width: 170px; max-width:170px;">
                                    <a href="{:url('system/add_agent_right',array('sm_id'=>$vo['sm_id']))}" class="btn blue"><i class="fa fa-pencil-square-o"></i>编辑</a>
                                    <a class="btn red"  href="javascript:void(0)" data-url="{:url('system/del_right')}" data-id="{$vo.sm_id}" onClick="delfun(this)"><i class="fa fa-trash-o"></i>删除</a>
                                </div>
                            </td>
                            <td align="" class="" style="width: 100%;">
                                <div>&nbsp;</div>
                            </td>
                        </tr>
                    {/foreach}
                    </tbody>
                </table>
            </div>
            <div class="iDiv" style="display: none;"></div>
        </div>
        {$page|raw}
        <!--分页位置-->
         </div>
    <script>
        function showDesc(obj){
            layer.alert($(obj).html(),{title:'备注：'});
        }

        function delfun(obj){
            if(confirm('确认删除')){
                $.ajax({
                    type:'post',
                    url: $(obj).attr('data-url'),
                    data:{sm_id:$(obj).attr('data-id')},
                    dataType:'json',
                    success:function(data){
                        if(data.code===1){
                            $(obj).parents('tr').remove();
                        }else{
                            layer.alert('删除失败', {icon: 2});  //alert('删除失败');
                        }
                    }
                })
            }
            return false;
        }
    </script>
</body>
</html>
